import 'package:oramemo/generated/json/base/json_convert_content.dart';
import 'package:oramemo/entity/voice_record_entity.dart';

VoiceRecordEntity $VoiceRecordEntityFromJson(Map<String, dynamic> json) {
  final VoiceRecordEntity voiceRecordEntity = VoiceRecordEntity();
  final int? total = jsonConvert.convert<int>(json['total']);
  if (total != null) {
    voiceRecordEntity.total = total;
  }
  final List<VoiceRecordRows>? rows = (json['rows'] as List<dynamic>?)
      ?.map(
          (e) => jsonConvert.convert<VoiceRecordRows>(e) as VoiceRecordRows)
      .toList();
  if (rows != null) {
    voiceRecordEntity.rows = rows;
  }
  final int? code = jsonConvert.convert<int>(json['code']);
  if (code != null) {
    voiceRecordEntity.code = code;
  }
  final String? msg = jsonConvert.convert<String>(json['msg']);
  if (msg != null) {
    voiceRecordEntity.msg = msg;
  }
  return voiceRecordEntity;
}

Map<String, dynamic> $VoiceRecordEntityToJson(VoiceRecordEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['total'] = entity.total;
  data['rows'] = entity.rows?.map((v) => v.toJson()).toList();
  data['code'] = entity.code;
  data['msg'] = entity.msg;
  return data;
}

extension VoiceRecordEntityExtension on VoiceRecordEntity {
  VoiceRecordEntity copyWith({
    int? total,
    List<VoiceRecordRows>? rows,
    int? code,
    String? msg,
  }) {
    return VoiceRecordEntity()
      ..total = total ?? this.total
      ..rows = rows ?? this.rows
      ..code = code ?? this.code
      ..msg = msg ?? this.msg;
  }
}

VoiceRecordRows $VoiceRecordRowsFromJson(Map<String, dynamic> json) {
  final VoiceRecordRows voiceRecordRows = VoiceRecordRows();
  final String? createTime = jsonConvert.convert<String>(json['createTime']);
  if (createTime != null) {
    voiceRecordRows.createTime = createTime;
  }
  final VoiceRecordRowsParams? params = jsonConvert.convert<
      VoiceRecordRowsParams>(json['params']);
  if (params != null) {
    voiceRecordRows.params = params;
  }
  final int? id = jsonConvert.convert<int>(json['id']);
  if (id != null) {
    voiceRecordRows.id = id;
  }
  final int? deviceId = jsonConvert.convert<int>(json['deviceId']);
  if (deviceId != null) {
    voiceRecordRows.deviceId = deviceId;
  }
  final int? userId = jsonConvert.convert<int>(json['userId']);
  if (userId != null) {
    voiceRecordRows.userId = userId;
  }
  final int? voiceType = jsonConvert.convert<int>(json['voiceType']);
  if (voiceType != null) {
    voiceRecordRows.voiceType = voiceType;
  }
  final int? aiPlatform = jsonConvert.convert<int>(json['aiPlatform']);
  if (aiPlatform != null) {
    voiceRecordRows.aiPlatform = aiPlatform;
  }
  final int? status = jsonConvert.convert<int>(json['status']);
  if (status != null) {
    voiceRecordRows.status = status;
  }
  final int? readStatus = jsonConvert.convert<int>(json['readStatus']);
  if (readStatus != null) {
    voiceRecordRows.readStatus = readStatus;
  }
  final String? voiceFolderId = jsonConvert.convert<String>(
      json['voiceFolderId']);
  if (voiceFolderId != null) {
    voiceRecordRows.voiceFolderId = voiceFolderId;
  }
  final String? voicePath = jsonConvert.convert<String>(json['voicePath']);
  if (voicePath != null) {
    voiceRecordRows.voicePath = voicePath;
  }
  final String? voiceContent = jsonConvert.convert<String>(
      json['voiceContent']);
  if (voiceContent != null) {
    voiceRecordRows.voiceContent = voiceContent;
  }
  final String? voiceTransliterate = jsonConvert.convert<String>(
      json['voiceTransliterate']);
  if (voiceTransliterate != null) {
    voiceRecordRows.voiceTransliterate = voiceTransliterate;
  }
  final int? voiceDuration = jsonConvert.convert<int>(json['voiceDuration']);
  if (voiceDuration != null) {
    voiceRecordRows.voiceDuration = voiceDuration;
  }
  return voiceRecordRows;
}

Map<String, dynamic> $VoiceRecordRowsToJson(VoiceRecordRows entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['createTime'] = entity.createTime;
  data['params'] = entity.params?.toJson();
  data['id'] = entity.id;
  data['deviceId'] = entity.deviceId;
  data['userId'] = entity.userId;
  data['voiceType'] = entity.voiceType;
  data['aiPlatform'] = entity.aiPlatform;
  data['status'] = entity.status;
  data['readStatus'] = entity.readStatus;
  data['voiceFolderId'] = entity.voiceFolderId;
  data['voicePath'] = entity.voicePath;
  data['voiceContent'] = entity.voiceContent;
  data['voiceTransliterate'] = entity.voiceTransliterate;
  data['voiceDuration'] = entity.voiceDuration;
  return data;
}

extension VoiceRecordRowsExtension on VoiceRecordRows {
  VoiceRecordRows copyWith({
    String? createTime,
    VoiceRecordRowsParams? params,
    int? id,
    int? deviceId,
    int? userId,
    int? voiceType,
    int? aiPlatform,
    int? status,
    int? readStatus,
    String? voiceFolderId,
    String? voicePath,
    String? voiceContent,
    String? voiceTransliterate,
    int? voiceDuration,
  }) {
    return VoiceRecordRows()
      ..createTime = createTime ?? this.createTime
      ..params = params ?? this.params
      ..id = id ?? this.id
      ..deviceId = deviceId ?? this.deviceId
      ..userId = userId ?? this.userId
      ..voiceType = voiceType ?? this.voiceType
      ..aiPlatform = aiPlatform ?? this.aiPlatform
      ..status = status ?? this.status
      ..readStatus = readStatus ?? this.readStatus
      ..voiceFolderId = voiceFolderId ?? this.voiceFolderId
      ..voicePath = voicePath ?? this.voicePath
      ..voiceContent = voiceContent ?? this.voiceContent
      ..voiceTransliterate = voiceTransliterate ?? this.voiceTransliterate
      ..voiceDuration = voiceDuration ?? this.voiceDuration;
  }
}

VoiceRecordRowsParams $VoiceRecordRowsParamsFromJson(
    Map<String, dynamic> json) {
  final VoiceRecordRowsParams voiceRecordRowsParams = VoiceRecordRowsParams();
  return voiceRecordRowsParams;
}

Map<String, dynamic> $VoiceRecordRowsParamsToJson(
    VoiceRecordRowsParams entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  return data;
}

extension VoiceRecordRowsParamsExtension on VoiceRecordRowsParams {
}